<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>

<!--预编译----------------------------------------------------------------------->
<script type="text/html">
    //
    console.log(test);          //fn
    function test(test) {
    console.log(test);      //fn
    var test = 234;
    console.log(test);      //234
    function test() {
    console.log(1);
    }
    }

    test(1);
    var test = 123;
    console.log(test);          //123
</script>

<!-- 逗号运算符与预编译 ---------------------------------------------------------->
<script type="text/html">
    //
    var f = (function f() {
    return "1";
    }, function g() {
    console.log(typeof g);
    return 2;
    })();
    console.log(typeof f);
    console.log(typeof g);
</script>

<!--笔试题----------------------------------------------------------------------->
<script type="text/html">
    //
    var x = 1, y = 0, z = 0;

    function foo(n) {
        return n = n + 1;
    }

    y = foo(x);

    function foo(n) {
        return n = n + 3;
    }

    z = foo(x);
    console.log(x+','+y+','+z);
</script>

<!--笔试题拓展------------------------------------------------------------------->
<script type="text/html">
    //
    var x = 1, y = 0, z = 0;
    var foo;
    foo=function (n) {
        return n = n + 1;
    };

    y = foo(x);

    foo=function (n) {
        return n = n + 3;
    };

    z = foo(x);
    console.log(x+','+y+','+z);
</script>

</html>